import Vue from "vue";
import CollapseTransition from "element-ui/lib/transitions/collapse-transition";
import selectGroup from "./unit/selectGroup";
import unitTable from "./unit/table";
import unitCards from "./unit/cards";
import pagination from "./unit/pagination";
import upload from "./unit/upload";
import treebox from "./unit/treebox";

Vue.component(CollapseTransition.name, CollapseTransition);
Vue.component("selectGroup", selectGroup);
Vue.component("unitTable", unitTable);
Vue.component("unitCards", unitCards);
Vue.component("pagination", pagination);
Vue.component("upload", upload);
Vue.component("treebox", treebox);
// 显示code
Vue.component("unitIcon", {
  props: {
    color: {
      type: String,
      default: "#4d6ee8"
    },
    disabled: {
      type: Boolean,
      default: false
    },
    size: {
      type: Number,
      default: 20
    },
    type: {
      type: String,
      default: ""
    }
  },
  components: {
    detail: resolve => require(["./icon/detail.vue"], resolve),
    add: resolve => require(["./icon/add.vue"], resolve),
    edit: resolve => require(["./icon/edit.vue"], resolve),
    delete: resolve => require(["./icon/delete.vue"], resolve),
    start: resolve => require(["./icon/start.vue"], resolve),
    stop: resolve => require(["./icon/stop.vue"], resolve),
    refresh: resolve => require(["./icon/refresh.vue"], resolve),
    authority: resolve => require(["./icon/authority.vue"], resolve),
    user: resolve => require(["./icon/user.vue"], resolve)
  },
  template: `<svg t="1594783052294" class="icon" viewBox="0 0 1024 1024" version="1.1"
  xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" :fill="disabled?'#c0c4cc':color" v-if="type">
  <component :is="type" />
  </svg>`
});
